package com.aaa;

import com.aaa.config.RuleConfig;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.netflix.ribbon.RibbonClient;
import org.springframework.cloud.netflix.ribbon.RibbonClients;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;

/**
 * @author ：Mickey
 * @date ：Created in 2022/11/17 16:15
 * @description：
 * @modified By：
 * @version:
 */
@EnableDiscoveryClient
@SpringBootApplication
@EnableFeignClients//开启feign注解
@MapperScan(basePackages = "com.aaa.dao")
@RibbonClients(value = {
        @RibbonClient(name = "shop-product",configuration = RuleConfig.class)
})
public class OrderApplication {
    public static void main(String[] args) {
        SpringApplication.run(OrderApplication.class,args);
    }

    @Bean
    @LoadBalanced   //策略轮询
    public RestTemplate restTemplate(){
        RestTemplate restTemplate = new RestTemplate();
        return restTemplate;
    }
}